﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EvalStudent.aspx.cs" Inherits="WebApplication1.EvalStudent" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<script runat="server">

    void Button1_Click(Object sender, System.EventArgs e)
    {
        SqlCommand myCom;
        SqlDataReader myReader = null;    
        List<string> myStudent = GetMyStudentName();
        int i = 1;
        
        foreach (string temp in myStudent)
        {
            string query = "update OPEN_SUBJECT set subject_score = '"+GetScore(i)+"' where student_email = '"+temp+"'";//dkdldb@naver.com'";
            
            myCom = new SqlCommand(query, evalstudent_aspx.GetSqlConn());
            myReader = myCom.ExecuteReader();

            ++i;
        }

        if (myReader != null) myReader.Close();
        ShowMsgBox();       
    }

    public string GetScore(int index)
    {
        switch (index)
        {
            case 1:
                return RadioButtonList1.SelectedValue;
            case 2:
                return RadioButtonList2.SelectedValue;
            case 3:
                return RadioButtonList3.SelectedValue;
            case 4:
                return RadioButtonList4.SelectedValue;
            case 5:
                return RadioButtonList5.SelectedValue;   
        }
        return null;
    }

</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:Label ID="Label1" runat="server" Text="Label" Visible=false></asp:Label>
        <asp:RadioButtonList ID="RadioButtonList1" runat="server" Visible=false>
        <asp:ListItem>A</asp:ListItem>
        <asp:ListItem>B</asp:ListItem>
        <asp:ListItem>C</asp:ListItem>
        <asp:ListItem>D</asp:ListItem>
        <asp:ListItem>E</asp:ListItem>
        </asp:RadioButtonList>

        <asp:Label ID="Label2" runat="server" Text="Label" Visible=false></asp:Label>
        <asp:RadioButtonList ID="RadioButtonList2" runat="server" Visible=false>
        <asp:ListItem>A</asp:ListItem>
        <asp:ListItem>B</asp:ListItem>
        <asp:ListItem>C</asp:ListItem>
        <asp:ListItem>D</asp:ListItem>
        <asp:ListItem>E</asp:ListItem>
        </asp:RadioButtonList>

                <asp:Label ID="Label3" runat="server" Text="Label" Visible=false></asp:Label>
        <asp:RadioButtonList ID="RadioButtonList3" runat="server" Visible=false>
        <asp:ListItem>A</asp:ListItem>
        <asp:ListItem>B</asp:ListItem>
        <asp:ListItem>C</asp:ListItem>
        <asp:ListItem>D</asp:ListItem>
        <asp:ListItem>E</asp:ListItem>
        </asp:RadioButtonList>

                <asp:Label ID="Label4" runat="server" Text="Label" Visible=false></asp:Label>
        <asp:RadioButtonList ID="RadioButtonList4" runat="server" Visible=false>
        <asp:ListItem>A</asp:ListItem>
        <asp:ListItem>B</asp:ListItem>
        <asp:ListItem>C</asp:ListItem>
        <asp:ListItem>D</asp:ListItem>
        <asp:ListItem>E</asp:ListItem>
        </asp:RadioButtonList>

                <asp:Label ID="Label5" runat="server" Text="Label" Visible=false></asp:Label>
        <asp:RadioButtonList ID="RadioButtonList5" runat="server" Visible=false>
        <asp:ListItem>A</asp:ListItem>
        <asp:ListItem>B</asp:ListItem>
        <asp:ListItem>C</asp:ListItem>
        <asp:ListItem>D</asp:ListItem>
        <asp:ListItem>E</asp:ListItem>
        </asp:RadioButtonList>
    
        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Submit"  />
    
    </div>
    </form>
</body>
</html>
